﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using SchoolProject2012.Langue;

namespace SchoolProject2012.Domain
{
    [MetadataType(typeof(contactEntrepriseCV))]
    public class Contactentreprise
    {
        public int id { get; set; }
        public string nom { get; set; }
        public string prenom { get; set; }
        public string telephone { get; set; }
        public string mobile { get; set; }
        public string mail { get; set; }
        public string infoComp { get; set; }
        public int idEntreprise { get; set; }

        #region controle de validite

        public bool isValidEntreprise()
        {
            return true;
        }




        public class contactEntrepriseCV
        {
            public int id { get; set; }
            [StringLength(50), Required]
            public string nom { get; set; }
            [StringLength(50), Required]
            public string prenom { get; set; }
            [StringLength(50)]
            [DataType(DataType.PhoneNumber)]
            [RegularExpression(@"^[0-9.+()\s-]*$", ErrorMessageResourceType = typeof(Resources), ErrorMessageResourceName = "ErrorMessageMail")]
            public string telephone { get; set; }
            [StringLength(50)]
            [DataType(DataType.PhoneNumber)]
            [RegularExpression(@"^[0-9.+()\s-]*$", ErrorMessageResourceType = typeof(Resources), ErrorMessageResourceName = "ErrorMessageMail")]
            public string mobile { get; set; }
            [StringLength(255)]
            [DataType(DataType.EmailAddress)]
            [RegularExpression(@"^[a-z0-9.-]+@[a-z0-9.-]{2,}\.[a-z]{2,4}$", ErrorMessageResourceType = typeof(Resources), ErrorMessageResourceName = "ErrorMessageMail")]
            [Display(ResourceType = typeof(Resources), Name = "lblCompanyMail")]
            public string mail { get; set; }
            public string infoComp { get; set; }
            public int idEntreprise { get; set; }

            public contactEntrepriseCV(){}

            public contactEntrepriseCV(Contactentreprise con)
            {
                nom = con.nom;
                prenom = con.prenom;
                telephone = con.telephone;
                mobile = con.mobile;
                mail = con.mail;
                infoComp = con.infoComp;
                idEntreprise = con.idEntreprise;
            }
        }
        #endregion
    
    }
}